package data

import (
	"fmt"

	fgorm "gitee.com/go-mod/framework/gorm"
	fredis "gitee.com/go-mod/framework/redis"
	"github.com/google/wire"
	"github.com/redis/go-redis/v9"
	"gorm.io/gorm"
)

var ProviderSet = wire.NewSet(NewData)

type Data struct {
	Mysql *gorm.DB
	Redis *redis.Client
}

func NewData() (*Data, func(), error) {
	data := &Data{
		Mysql: fgorm.OpenMysql(""),
		Redis: fredis.Client(""),
	}

	cleanup := func() {
		fmt.Println("closing the data resources")
	}
	return data, cleanup, nil
}
